package PTA_JAVA.JavaB.Javademo12;
import java.lang.reflect.*;
import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        double a = sc.nextDouble(), b = sc.nextDouble();
        System.out.println(Calculator.add(a, b));
        System.out.println(Calculator.substract(a, b));
        System.out.println(Calculator.multiply(a, b));
        System.out.println(Calculator.divide(a, b));
        double numb = sc.nextDouble();
        System.out.println(Calculator.perimeter(numb));
        System.out.println(Calculator.area(numb));
        double x=sc.nextDouble();
        System.out.println(Calculator.log(x));

//------------------------测试------------------------------//
        Class<?> clazz = Calculator.class;
        Field[] fields = clazz.getDeclaredFields();
        Method[] methods = clazz.getDeclaredMethods();
        boolean flag=true;
        System.out.println(clazz);
        for (Field field : fields) {
            if(Modifier.isFinal(field.getModifiers())&&Modifier.isStatic(field.getModifiers())!=true)
                flag=false;
        }
        for (Method method : methods) {
            if(Modifier.isStatic(method.getModifiers())!=true)
                flag=false;
        }
        System.out.println(flag);
    }
}
final class Calculator{
    final static double PI =3.14;
    final static double E =2.71828;//使用这些常量来进行计算

    static double add(double numb1, double numb2){
        return numb1+numb2;
    }//两个数相加

    static double substract(double numb1,double numb2){
        return numb1-numb2;
    }//两个数相减

    static double multiply(double numb1,double numb2){
        return numb1*numb2;
    }//两个数相乘

    static double divide(double numb1,double numb2){
        return numb1/numb2;
    }//两个数相除

    static double perimeter(double numb){
        return 2*PI*numb;
    }//给定半径求周长

    static double area(double numb){
        return numb*numb*PI;
    }//给定半径求面积

    static double log(double numb){
        return Math.log10(numb)/Math.log10(Calculator.E);
    }//给定一个数X（>0）
}
